package com.mmall.concurrency.example.aqs.phaser;

public class PhaserTest {
    // 先构建一个阶段器对象
    private static TravelPhaser travelPhaser = new TravelPhaser();
    // 主逻辑
    public static void main(String[] args) throws InterruptedException {
        // 创建 5 个线程代表每一位同事
        for (int i = 1; i < 5; i++) {
            // 对每一个需要同步控制的线程进行同步控制注册
            travelPhaser.register();
            // 模拟每一位同事开始旅游行动
            Thread thread = new Thread(new Colleague(travelPhaser), "同事" + i);
            thread.start();
        }
    }
}
